{{FOREACH subTask;[[subtaskList]]}}
  <tr>
    <td {{IF [[subTask.getVal('sumProgress')]] < [[subTask.getVal('keyspace')]]}}rel="popover" data-img="api/taskimg.php?task=[[subTask.getVal('taskId')]]&x=1200&y=6"{{ENDIF}}{{IF [[strlen([[subTask.getVal('color')]])]] > 0}} style="background-color: #[[subTask.getVal('color')]]"{{ENDIF}}>
      {{IF [[accessControl.hasPermission([[$DAccessControl::VIEW_TASK_ACCESS]])]]}}
        <a href="tasks.php?id=[[subTask.getVal('taskId')]]">[[subTask.getVal('taskId')]]</a>
      {{ELSE}}
        [[subTask.getVal('taskId')]]
      {{ENDIF}}
    </td>
    <td title="[[htmlentities([[subTask.getVal('attackCmd')]], ENT_QUOTES, 'UTF-8')]]">
      {{IF [[accessControl.hasPermission([[$DAccessControl::VIEW_TASK_ACCESS]])]]}}
        <a href="tasks.php?id=[[subTask.getVal('taskId')]]">[[subTask.getVal('taskName')]]</a>
      {{ELSE}}
        [[subTask.getVal('taskName')]]
      {{ENDIF}}
      [[Util::tickdone([[subTask.getVal('sumProgress')]], [[subTask.getVal('keyspace')]])]]
      {{IF [[subTask.getVal('fileSecret')]]}}
      <span class="fas fa-lock" aria-hidden="true"></span>
      {{ENDIF}}
      {{IF [[subTask.getVal('isActive')]] == 1 && [[subTask.getVal('sumProgress')]] < [[subTask.getVal('keyspace')]]}}
        <i class="fas fa-spinner fa-spin"></i>
      {{ENDIF}}
      {{IF [[subTask.getVal('cpuOnly')]] == 1}}
        <br>CPU only
      {{ENDIF}}
      {{IF [[subTask.getVal('isSmall')]] == 1}}
        <br>Small Task
      {{ENDIF}}
      {{IF [[subTask.getVal('isPrince')]] == 1}}
        <br>PRINCE
      {{ENDIF}}
    </td>
    {{IF [[subTask.getVal('keyspace')]] > 0}}
      <td class='num'>
        [[Util::showperc([[subTask.getVal('taskProgress')]], [[subTask.getVal('keyspace')]])]]% /
        [[Util::showperc([[subTask.getVal('sumProgress')]], [[subTask.getVal('keyspace')]])]]%
      </td>
    {{ELSE}}
      <td>&nbsp;</td>
    {{ENDIF}}
    <td class='num' style="min-width: 50px;">
      {{IF [[subTask.getVal('cracked')]] > 0 && [[accessControl.hasPermission([[$DAccessControl::VIEW_HASHES_ACCESS]])]]}}
        <a href="hashes.php?task=[[subTask.getVal('taskId')]]&filter=cracked">[[subTask.getVal('cracked')]] {{IF [[config.getVal([[$DConfig::SHOW_TASK_PERFORMANCE]])]] == 1}}([[subTask.getVal('performance')]]c/m){{ENDIF}}</a>
      {{ENDIF}}
      {{IF [[subTask.getVal('cracked')]] > 0 && ![[accessControl.hasPermission([[$DAccessControl::VIEW_HASHES_ACCESS]])]]}}
        [[subTask.getVal('cracked')]] {{IF [[config.getVal([[$DConfig::SHOW_TASK_PERFORMANCE]])]] == 1}}([[subTask.getVal('performance')]]c/m){{ENDIF}}
      {{ENDIF}}
    </td>
    <td class='num' style="min-width: 50px;">
      {{IF [[subTask.getVal('numAssignments')]] > 0}}
        [[subTask.getVal('numAssignments')]]
        {{IF [[subTask.getVal('isActive')]]}}  
          <br>
          @[[Util::nicenum([[subTask.getVal('speed')]], 10000, 1000)]]H/s
        {{ENDIF}}
      {{ENDIF}}
    </td>
    <td style='min-width: 130px' data-sort="[[subTask.getVal('priority')]]">
      {{IF [[accessControl.hasPermission([[$DAccessControl::MANAGE_TASK_ACCESS]])]]}}
        <form class="form-inline" action="tasks.php" method="POST">
          <input type='hidden' name='action' value='[[$DTaskAction::SET_PRIORITY]]'>
          <input type="hidden" name="task" value="[[subTask.getVal('taskId')]]">
          <input type="hidden" name="csrf" value="[[csrf]]">
          <input type="text" class='form-control' style='width: 60px;' name="priority" size="4" value="[[subTask.getVal('priority')]]" title="Priority">
          <button type="submit" class='btn {{IF [[toggledarkmode]] > 0}}btn-primary{{ELSE}}btn-light{{ENDIF}} mx-1' data-toggle="tooltip" data-placement="top" title="Set"><i class="fas fa-save" aria-hidden="true"></i></button>
        </form>
      {{ELSE}}
        [[subTask.getVal('priority')]]
      {{ENDIF}}
    </td>
    <td style='min-width: 130px' data-sort="[[subTask.getVal('maxAgents')]]">
      {{IF [[accessControl.hasPermission([[$DAccessControl::MANAGE_TASK_ACCESS]])]]}}
      <form class="form-inline" action="tasks.php" method="POST">
        <input type='hidden' name='action' value='[[$DTaskAction::SET_MAX_AGENTS]]'>
        <input type="hidden" name="task" value="[[subTask.getVal('taskId')]]">
        <input type="hidden" name="csrf" value="[[csrf]]">
        <input type="text" class='form-control' style='width: 60px;' name="maxAgents" size="4" value="[[subTask.getVal('maxAgents')]]" title="Max agents">
        <button type="submit" class='btn {{IF [[toggledarkmode]] > 0}}btn-primary{{ELSE}}btn-light{{ENDIF}} mx-1' data-toggle="tooltip" data-placement="top" title="Set"><i class="fas fa-save" aria-hidden="true"></i></button>
      </form>
      {{ELSE}}
        [[subTask.getVal('maxAgents')]]
      {{ENDIF}}
    </td>
    <td style='min-width: 120px'>
      {{IF [[accessControl.hasPermission([[$DAccessControl::CREATE_TASK_ACCESS]])]]}}
        <form class="float-right mx-1" action="tasks.php" method="POST" onSubmit="if (!confirm('Really delete task [[subTask.getVal('taskId')]]?')) return false;">
          <input type="hidden" name="action" value="[[$DTaskAction::DELETE_TASK]]">
          <input type="hidden" name="csrf" value="[[csrf]]">
          <input type="hidden" name="task" value="[[subTask.getVal('taskId')]]">
          <button type="submit" class='btn btn-danger' data-toggle="tooltip" data-placement="top" title="Delete"><i class="fas fa-trash" aria-hidden="true"></i></button>
        </form>
        {{IF ![[showArchived]]}}
          <form class="float-right mx-1" action="tasks.php" method="POST" onSubmit="if (!confirm('Really archive task [[subTask.getVal('taskId')]]?')) return false;">
            <input type="hidden" name="action" value="[[$DTaskAction::ARCHIVE_TASK]]">
            <input type="hidden" name="task" value="[[subTask.getVal('taskId')]]">
            <input type="hidden" name="csrf" value="[[csrf]]">
            <button type="submit" class='btn btn-warning' data-toggle="tooltip" data-placement="top" title="Archive Task"><i class="fas fa-archive" aria-hidden="true"></i></button>
          </form>
        {{ENDIF}}
        <form class="float-right mx-1" action="tasks.php?new=true&copy=[[subTask.getVal('taskId')]]" method="post">
          <button type="submit" class='btn {{IF [[toggledarkmode]] > 0}}btn-primary{{ELSE}}btn-light{{ENDIF}}' data-toggle="tooltip" data-placement="top" title="Copy to Task"><i class="fas fa-copy" aria-hidden="true"></i></button>
        </form>
        {{IF [[accessControl.hasPermission([[$DAccessControl::CREATE_PRETASK_ACCESS]])]]}}
				  <form class="float-right mx-1" action="pretasks.php?new=true&copyTask=[[subTask.getVal('taskId')]]" method="POST">
            <button type="submit" class='btn {{IF [[toggledarkmode]] > 0}}btn-primary{{ELSE}}btn-light{{ENDIF}}' data-toggle="tooltip" data-placement="top" title="Copy to Pretask"><i class="fas fa-bookmark" aria-hidden="true"></i></button>
				  </form>
			  {{ENDIF}}
      {{ENDIF}}
    </td>
  </tr>
{{ENDFOREACH}}